<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div>
    <input type="text" placeholder="请输入1-100之间的整数" v-model="num">
    <button @click="f()">按钮</button>
    <h1>结果：{{result}}</h1>
</div>
<script src="../js/vue.js"></script>
<script>
    let x = parseInt(Math.random()*100)+1;
    let v = new Vue({
        el:"body>div",
        data() {
            return {
                result: "",num:""
            }
        },
        methods: {
            f() {
              if(v.num>x){
                  v.result = "猜大啦!"
              }else if(v.num<x){
                  v.result = "猜小了！"
              }else {
                  v.result = "恭喜你猜对啦！！"
              }
            }
        },
    })
</script>
</body>
</html>